# -*- coding: utf-8 -*-

#Resources's file.
import imgs.icons_rc 
#import win32clipboard
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from ui.feedSubscribe import Ui_FeedSubscribe

class FeedSubscribeWidget(QDialog):
	def setup(self):
		self.ui = Ui_FeedSubscribe()
		self.ui.setupUi(self)

	def __init__(self,parent = None):
		super(FeedSubscribeWidget, self).__init__(parent)
		self.setup()
		self.setIcons()
		QObject.connect(self.ui.btnAceptar, SIGNAL("clicked()"), self.sendNewSubscribe)
		QObject.connect(self.ui.btnCancelar, SIGNAL("clicked()"), self.close)

	#Method that set the icons in the Form
	def setIcons(self):
		self.ui.btnAceptar.setIcon(QIcon(":/accept"))
		self.ui.btnCancelar.setIcon(QIcon(":/cancel"))
		self.ui.lblLogo.setPixmap(QPixmap(":/subscribeFeed"))

	#Method that send a signal to rss_reader
	def sendNewSubscribe(self):
		#Esta se�al es agarrada por la clase main (principal hilo de ejecucion)
		self.emit(SIGNAL("newSubscribe(PyQt_PyObject)"),self.ui.lineEditFeed.text())
		self.close()

	def showEvent(self,evt):
		self.ui.lineEditFeed.setText("")
		#win32clipboard.OpenClipboard()
		#self.ui.lineEditFeed.setText(win32clipboard.GetClipboardData())
		#win32clipboard.CloseClipboard()